package com.google.shop.product.socket.websocket;

import com.alibaba.fastjson.JSON;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;

@Component
/* loaded from: app.jar:BOOT-INF/classes/com/google/shop/product/socket/websocket/MessageHandler.class */
public class MessageHandler extends TextWebSocketHandler {
    private static final Map<String, WebSocketSession> SESSIONS = new HashMap();

    @Override // org.springframework.web.socket.handler.AbstractWebSocketHandler, org.springframework.web.socket.WebSocketHandler
    public void afterConnectionEstablished(WebSocketSession session) throws Exception {
        String uid = session.getAttributes().get("uid").toString();
        SESSIONS.put(uid, session);
        session.sendMessage(new TextMessage(JSON.toJSON(uid + "上线").toString()));
        System.out.println(uid + " 上线");
    }
}
